<script src="https://cdn.bootcss.com/vue/2.5.16/vue.min.js"></script>
<script src="https://cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
<!-- <script src="https://cdn.bootcss.com/amazeui/2.7.2/js/amazeui.min.js"></script> -->
<!-- <script src="https://unpkg.com/element-ui@2.4.8/lib/index.js"></script> -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/element-ui/2.4.7/index.js"></script>
<script src="https://cdn.bootcss.com/axios/0.18.0/axios.min.js"></script>
<script src="https://cdn.bootcss.com/qs/6.5.2/qs.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/layer/2.3/layer.js"></script>
<script src="/jh/app/js/global.js?v=1"></script>
<script type="text/javascript" src="/jh/admin/components/pageJs.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9/crypto-js.min.js"></script>
<script type="text/javascript">
function msg(msg) {
    layer.msg(msg);
}

function remind(msg) {
    layer.alert(msg);
}

function confirm(msg, confirmText, func) {
    layer.open({
        content: msg,
        btn: [confirmText, '取消'],
        yes: function(index) {
            func();
            layer.close(index);
        }
    });
}

/*上传图片到sm*/
function onUploadSMImage(file) {
    let formData = new FormData();
    formData.append('smfile', file.file);
    axios({
            method: 'post',
            url: 'https://sm.ms/api/upload',
            data: formData,
            headers: {
                'Content-Type': 'multipart/form-data'
            }
        })
        .then(function(res) {
            file.onSuccess(res.data, file.file)
            return
        })
}

function replaceBr(str) {
    if (str == null) {
        return ''
    }
    var val = str + ''
    val = val.replace(/<br\/>/g, "\n");
    return val;
}

function replaceN(str) {
    if (str == null) {
        return ''
    }
    var val = str + ''
    val = val.replace('\n', "<br/>")
    return val;
}

function loading() {
    // layer.open({ type: 2 });
    layer.load();
}

function endLoading() {
    layer.closeAll();
}


function axiosRequestPro(params, url, success, fail, complete) {
    var param = Qs.stringify(params);
    loading()
    axios({
            url: url,
            method: 'post',
            data: param,
            headers: {
                'Content-Type': 'application/x-www-form-urlencoded'
            }
        })
        .then(function(response) {
            complete()
            endLoading();
            var status = response.data.status
            if (status == 200) {
                endLoading();
                // if (redirect == '') {
                //     window.location.reload()
                // } else {
                //     window.location.href = redirect
                // }
                success(response.data)
                // msg("登录成功");
            } else if (status == 204) {
                // msg(response.data.msg);
                vue.$alert(response.data.msg, '提示', {
                    confirmButtonText: '确定',
                    callback: action => {}
                });
            } else {
                // msg(response.data.msg);
                fail()
                console.log(response.data);
            }
        })
        .catch(function(error) {
            complete()
            fail()
            endLoading();
            msg("请求失败");
            console.log(error);
        });
}

function axiosRequest(params, url, redirect) {
    var param = Qs.stringify(params);
    loading()
    axios({
            url: url,
            method: 'post',
            data: param,
            headers: {
                'Content-Type': 'application/x-www-form-urlencoded'
            }
        })
        .then(function(response) {
            endLoading();
            var status = response.data.status
            if (status == 200) {
                endLoading();
                if (redirect == '') {
                    window.location.reload()
                } else {
                    window.location.href = redirect
                }
                // msg("登录成功");
            } else if (status == 204) {
                // msg(response.data.msg);
                vue.$alert(response.data.msg, '提示', {
                    confirmButtonText: '确定',
                    callback: action => {}
                });
            } else {
                msg(response.data.msg);
                console.log(response.data);
            }
        })
        .catch(function(error) {
            endLoading();
            msg("请求失败");
            console.log(error);
        });
}


function aes(key, text) {
    var aesText = text;
    var key = CryptoJS.enc.Utf8.parse(key);
    var iv = CryptoJS.enc.Utf8.parse('RandomInitVector');
    aesText = CryptoJS.AES.encrypt(text, key, {
        iv: iv,
        mode: CryptoJS.mode.CBC,
        padding: CryptoJS.pad.Pkcs7
    }).toString();
    return aesText;
}
</script>
<!-- <script type="text/javascript" src="//pingjs.qq.com/h5/hotclick.js?v2.0" name="mtah5hotclick" sid="500630613" hid="5b725500383ea"></script> -->
<script>
var _mtac = { "performanceMonitor": 1 };
(function() {
    var mta = document.createElement("script");
    mta.src = "//pingjs.qq.com/h5/stats.js?v2.0.4";
    mta.setAttribute("name", "MTAH5");
    mta.setAttribute("sid", "500630613");
    mta.setAttribute("cid", "500630698");
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(mta, s);
})();
</script>
<script type="text/javascript">
// alert('aass')
$("#header-change-pwd").click(function() {
    // layer.prompt({ title: '输入任何口令，并确认', formType: 1 }, function(pass, index) {
    //     layer.close(index);
    // });
});
$(".zhfoot").on('click', function() {
    alert('123')
})
</script>